package com.bcbim.operation_maintenance.business_department.mapper;

import com.bcbim.operation_maintenance_interface.business_department.dao.BusinessDepartmentDAO;
import com.bcbim.operation_maintenance_interface.business_department.vo.BusinessDepartmentDetailVO;
import com.bcbim.operation_maintenance_interface.business_department.vo.BusinessDepartmentTreeVO;
import com.bcbim.operation_maintenance_interface.business_department.vo.ListBusinessDepartmentTreeVO;
import com.bcbim.operation_maintenance_interface.business_department.vo.ListBusinessDepartmentVO;
import com.bcbim.common.sys.Code;
import com.bcbim.operation_maintenance_interface.department.vo.DepartmentTreeVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import com.bcbim.operation_maintenance_interface.space.dto.SpaceDTO;

import java.util.List;

/**
 * @version V 1.0.0
 * @Description：业务部mapper
 * @Author: haomeijie
 * @Date: 2022/3/8 17:36
 **/
@Mapper
public interface BusinessDepartmentMapper {
    /**
     * 业务部-部门树形结构
     *
     * @return List<BusinessDepartmentTreeVO>
     * @Author: haomeijie
     * @Date: 2022/3/8 17:31
     */
    List<BusinessDepartmentTreeVO> listDepartmentTree(String projectId);

    /**
     * 新增部门
     *
     * @param businessDepartmentDAO businessDepartmentDAO
     * @author xuehao
     * @createDate 2022/3/9 14:16
     * @retuen int
     */
    int insertBusinessDepartment(BusinessDepartmentDAO businessDepartmentDAO);

    /**
     * 判断部门名称是否同名
     *
     * @param businessDepartmentName
     * @param id
     * @author xuehao
     * @createDate 2022/3/9 14:26
     * @retuen int
     */
    int checkBusinessDepartmentName(@Param("businessDepartmentName") String businessDepartmentName, @Param("projectId") String projectId, @Param("id") String id);

    /**
     * 用户下拉
     *
     * @author xuehao
     * @createDate 2022/3/9 14:32
     * @retuen List<Code>
     */
    List<Code> pullUser();

    /**
     * 编辑业务部
     *
     * @param businessDepartmentDAO
     * @author xuehao
     * @createDate 2022/3/9 14:54
     * @retuen int
     */
    int updateBusinessDepartment(BusinessDepartmentDAO businessDepartmentDAO);

    /**
     * 查询业务部详情
     *
     * @param id
     * @author xuehao
     * @createDate 2022/3/9 15:18
     * @retuen BusinessDepartmentDetailVO
     */
    BusinessDepartmentDetailVO getBusinessDepartment(String id);

    /**
     * 查询业务部下的部门
     *
     * @param businessDepartmentId businessDepartmentId
     * @author xuehao
     * @createDate 2022/3/10 10:24
     * @retuen List<String>
     */
    List<String> getDepartmentIds(String businessDepartmentId);

    /**
     * 根据业务部查询空间信息
     *
     * @param spaceDTO
     * @return List<ListBusinessDepartmentTreeVO>
     * @Author: haomeijie
     * @Date: 2022/3/15 13:26
     */
    List<ListBusinessDepartmentTreeVO> ListSpaceByBusiness(SpaceDTO spaceDTO);

    /**
     * 根据筛选条件查询业务部
     *
     * @param spaceDTO
     * @return List<ListBusinessDepartmentTreeVO>
     * @Author: haomeijie
     * @Date: 2022/3/30 10:33
     */
    List<ListBusinessDepartmentTreeVO> ListBusinessBySpace(SpaceDTO spaceDTO);

    /**
     * 根据部门查询空间信息
     *
     * @param spaceDTO
     * @return List<ListBusinessDepartmentTreeVO>
     * @Author: haomeijie
     * @Date: 2022/3/15 13:26
     */
    List<ListBusinessDepartmentTreeVO> listSpaceByDepartment(SpaceDTO spaceDTO);

    /**
     * 根据筛选条件查询部门
     *
     * @param spaceDTO
     * @return List<ListBusinessDepartmentTreeVO>
     * @Author: haomeijie
     * @Date: 2022/3/30 10:44
     */
    List<ListBusinessDepartmentTreeVO> listDepartmentBySpace(SpaceDTO spaceDTO);

    /**
     * 业务部列表
     *
     * @Author: haomeijie
     * @Date: 2022/3/22 18:39
     */
    List<ListBusinessDepartmentVO> listBusinessDepartment(@Param("name") String name, @Param("projectId") String projectId);

    /**
     * 根据筛选条件查询业务部-部门(未指派修改后)
     *
     * @param spaceDTO
     * @return List<ListBusinessDepartmentTreeVO>
     * @Author: haomeijie
     * @Date: 2022/4/2 15:12
     */
    List<ListBusinessDepartmentTreeVO> listDepartmentByQuery(SpaceDTO spaceDTO);

    /**
     * 查询业务部-部门(未指派修改后)
     *
     * @param spaceDTO
     * @return List<ListBusinessDepartmentTreeVO>
     * @Author: haomeijie
     * @Date: 2022/4/2 15:12
     */
    List<ListBusinessDepartmentTreeVO> listDepartment(SpaceDTO spaceDTO);

    /**
     * 获取未指派id
     *
     * @param unassignedName
     * @param projectId
     * @return String
     * @Author: haomeijie
     * @Date: 2022/4/6 16:50
     */
    String getUnassignedId(@Param("unassignedName") String unassignedName, @Param("projectId") String projectId);

    /**
     * 业务部-部门导出树形结构
     *
     * @return List<DepartmentTreeVO>
     * @Author: haomeijie
     * @Date: 2022/6/6 17:31
     */
    List<DepartmentTreeVO> listDepartmentExcelTree(String projectId);

}
